Failed Conditions
Push — develop ( 78df23...8d22aa )
by Reüel
09:06
created

index.js ➔ x   A

Complexity

Conditions 3

Size

Total Lines 1
Code Lines 1

Duplication

Lines 2
Ratio 200 %

Importance

Changes 0
Metric Value
cc 3
eloc 1
dl 2
loc 1
rs 10
c 0
b 0
f 0
1
!function(e){var t={};function r(n){if(t[n])return t[n].exports;var a=t[n]={i:n,l:!1,exports:{}};return e[n].call(a.exports,a,a.exports,r),a.l=!0,a.exports}r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)r.d(n,a,function(t){return e[t]}.bind(null,a));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=9)}([function(e,t){!function(){e.exports=this.wp.i18n}()},function(e,t){!function(){e.exports=this.wp.components}()},function(e,t){!function(){e.exports=this.wp.blockEditor}()},function(e,t){!function(){e.exports=this.wp.blocks}()},function(e){e.exports=JSON.parse('{"name":"pronamic-pay/fundraising-progress-circle","category":"pronamic-pay","attributes":{"raisedLabel":{"type":"string"},"raisedAmount":{"type":"string","default":"0"},"targetLabel":{"type":"string"},"targetAmount":{"type":"string","default":"0"},"contributionsLabel":{"type":"string"},"contributionsValue":{"type":"string","default":"0"},"currencyCode":{"type":"string","default":"EUR"},"currencyDecimals":{"type":"string","default":"2"},"locale":{"type":"string"},"color":{"type":"string","default":"#f9461c"}}}')},function(e){e.exports=JSON.parse('{"name":"pronamic-pay/fundraising-progress-bar","category":"pronamic-pay","attributes":{"raisedLabel":{"type":"string"},"raisedAmount":{"type":"string","default":"0"},"targetLabel":{"type":"string"},"targetAmount":{"type":"string","default":"0"},"contributionsLabel":{"type":"string"},"contributionsValue":{"type":"string","default":"0"},"currencyCode":{"type":"string","default":"EUR"},"currencyDecimals":{"type":"string","default":"2"},"locale":{"type":"string"},"color":{"type":"string","default":"#f9461c"}}}')},function(e){e.exports=JSON.parse('{"name":"pronamic-pay/fundraising-progress-text","category":"pronamic-pay","attributes":{"raisedLabel":{"type":"string"},"raisedAmount":{"type":"string","default":"0"},"targetLabel":{"type":"string"},"targetAmount":{"type":"string","default":"0"},"contributionsLabel":{"type":"string"},"contributionsValue":{"type":"string","default":"0"},"currencyCode":{"type":"string","default":"EUR"},"currencyDecimals":{"type":"string","default":"2"},"locale":{"type":"string"},"color":{"type":"string","default":"#f9461c"}}}')},function(e,t){!function(){e.exports=this.wp.element}()},function(e,t,r){var n;
0 ignored issues
show
Complexity introduced by
A for in loop automatically includes the property of any prototype object, consider checking the key using hasOwnProperty.

When iterating over the keys of an object, this includes not only the keys of the object, but also keys contained in the prototype of that object. It is generally a best practice to check for these keys specifically:

var someObject;
for (var key in someObject) {
    if ( ! someObject.hasOwnProperty(key)) {
        continue; // Skip keys from the prototype.
    }

    doSomethingWith(key);
}
Loading history...
unused-code introduced by
The call to bind does not seem necessary since the function does not use this. Consider calling it directly.
Loading history...
Coding Style Best Practice introduced by
Curly braces around statements make for more readable code and help prevent bugs when you add further statements.

Consider adding curly braces around all statements when they are executed conditionally. This is optional if there is only one statement, but leaving them out can lead to unexpected behaviour if another statement is added later.

Consider:

if (a > 0)
    b = 42;

If you or someone else later decides to put another statement in, only the first statement will be executed.

if (a > 0)
    console.log("a > 0");
    b = 42;

In this case the statement b = 42 will always be executed, while the logging statement will be executed conditionally.

if (a > 0) {
    console.log("a > 0");
    b = 42;
}

ensures that the proper code will be executed conditionally no matter how many statements are added or removed.

Loading history...
introduced by
You have used a bitwise operator & in a condition. Did you maybe want to use the logical operator &&
Loading history...
Bug introduced by
The variable Symbol seems to be never declared. If this is a global, consider adding a /** global: Symbol */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
Unused Code introduced by
The parameter r is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
Comprehensibility introduced by
Usage of the sequence operator is discouraged, since it may lead to obfuscated code.

The sequence or comma operator allows the inclusion of multiple expressions where only is permitted. The result of the sequence is the value of the last expression.

This operator is most often used in for statements.

Used in another places it can make code hard to read, especially when people do not realize it even exists as a seperate operator.

This check looks for usage of the sequence operator in locations where it is not necessary and could be replaced by a series of expressions or statements.

var a,b,c;

a = 1, b = 1,  c= 3;

could just as well be written as:

var a,b,c;

a = 1;
b = 1;
c = 3;

To learn more about the sequence operator, please refer to the MDN.

Loading history...
Unused Code introduced by
The parameter t is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
2
/*!
3
  Copyright (c) 2017 Jed Watson.
4
  Licensed under the MIT License (MIT), see
5
  http://jedwatson.github.io/classnames
6
*/!function(){"use strict";var r={}.hasOwnProperty;function a(){for(var e=[],t=0;t<arguments.length;t++){var n=arguments[t];if(n){var o=typeof n;if("string"===o||"number"===o)e.push(n);else if(Array.isArray(n)&&n.length){var c=a.apply(null,n);c&&e.push(c)}else if("object"===o)for(var i in n)r.call(n,i)&&n[i]&&e.push(i)}}return e.join(" ")}e.exports?(a.default=a,e.exports=a):void 0===(n=function(){return a}.apply(t,[]))||(e.exports=n)}()},function(e,t,r){"use strict";r.r(t);var n={};r.r(n),r.d(n,"metadata",(function(){return B})),r.d(n,"name",(function(){return G})),r.d(n,"settings",(function(){return U}));var a={};r.r(a),r.d(a,"metadata",(function(){return $})),r.d(a,"name",(function(){return Q})),r.d(a,"settings",(function(){return W}));var o={};r.r(o),r.d(o,"metadata",(function(){return ee})),r.d(o,"name",(function(){return ae})),r.d(o,"settings",(function(){return oe}));var c=r(3),i=r(1),l=r(0),u=React.createElement(i.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},React.createElement(i.Path,{d:"M10.9989003,2.04948449 L10.9991931,6.08309386 C8.16187679,6.55950437 6,9.02728549 6,12 C6,15.3137085 8.6862915,18 12,18 C14.9727145,18 17.4404956,15.8381232 17.9169061,13.0008069 L21.9505155,13.0010997 C21.4482817,18.0538953 17.1849719,22 12,22 C6.4771525,22 2,17.5228475 2,12 C2,6.81502805 5.94610473,2.55171825 10.9989003,2.04948449 Z M21.9506147,10.9998991 L17.9170737,11.0001915 C17.495595,8.48742361 15.5122967,6.50421563 12.9994831,6.08287175 L12.9999709,2.04937235 C17.7243674,2.51842511 21.4815017,6.27552034 21.9506147,10.9998991 Z"})),s=r(2),p=[{name:"orange",color:"#f9461c"},{name:"purple",color:"#6355ff"},{name:"green",color:"#2ce3be"}];function f(e,t){return e=parseFloat(e||0),0==(t=parseFloat(t||0))&&(0==e||e>t)&&(t=100),Math.floor(e/t*100)}function m(e,t,r,n){var a=e.lastIndexOf(".");if(a>-1){var o=e.substring(a+1).replace(/[0]+$/g,"").padEnd(r,"0");e=e.substring(0,a).replace(/\./g,"")+"."+o}var c=r;return 0==100*(e=parseFloat(e))%100&&(c=0),e.toLocaleString(n,{style:"currency",currency:t,minimumFractionDigits:c,maximumFractionDigits:c})}var b=r(7);function d(e){return(d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function g(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function y(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function v(e,t){return(v=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function h(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=R(e);if(t){var a=R(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return _(this,r)}}function _(e,t){return!t||"object"!==d(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function R(e){return(R=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var C=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&v(e,t)}(o,e);var t,r,n,a=h(o);function o(){return g(this,o),a.apply(this,arguments)}return t=o,(r=[{key:"render",value:function(){var e=this.props,t=e.colors,r=e.currencyCode,n=e.currencyDecimals,a=e.locale,o=e.raisedLabel,c=e.raisedAmount,i=e.targetLabel,l=e.targetAmount,u=e.contributionsLabel,p=e.contributionsValue,f=e.setAttributes;return t=t||{},r=r||"EUR",n=n||"2",a=a||"nl-NL",React.createElement("dl",{className:"ppfr-dl-list"},React.createElement(s.RichText,{tagName:"dt",className:"ppfr-dl-list__label",multiline:"false",value:o,onChange:function(e){f({raisedLabel:e})},style:t.hasOwnProperty("raisedLabel")&&{color:t.raisedLabel}}),React.createElement(s.RichText,{tagName:"dd",className:"ppfr-dl-list__value",multiline:"false",value:m(c||"0",r,n,a),onChange:function(e){var t=(e=e.replace(/,/g,".").replace(/[^\d.-]/g,"")).lastIndexOf(".");if(t>-1){var r=e.substring(t+1).replace(/[0]+$/g,"").padEnd(n,"0");e=e.substring(0,t).replace(/\./g,"")+"."+r}f({raisedAmount:e})},style:t.hasOwnProperty("raisedAmount")&&{color:t.raisedAmount}}),l&&React.createElement(React.Fragment,null,React.createElement(s.RichText,{tagName:"dt",className:"ppfr-dl-list__label",multiline:"false",value:i,onChange:function(e){f({targetLabel:e})}}),React.createElement(s.RichText,{tagName:"dd",className:"ppfr-dl-list__value",multiline:"false",value:m(l||"0",r,n,a),onChange:function(e){f({targetAmount:e.replace(/,/g,".").replace(/[^\d.-]/g,"")})}})),p&&React.createElement(React.Fragment,null,React.createElement(s.RichText,{tagName:"dt",className:"ppfr-dl-list__label",multiline:"false",value:u,onChange:function(e){f({contributionsLabel:e})}}),React.createElement(s.RichText,{tagName:"dd",className:"ppfr-dl-list__value",multiline:"false",value:parseInt(p||0).toString(),onChange:function(e){f({contributionsValue:e?e.replace(/[^\d]/g,""):"0"})},style:t.hasOwnProperty("contributionsValue")&&{color:t.contributionsValue}})))}}])&&y(t.prototype,r),n&&y(t,n),o}(b.Component),E=r(8),O=r.n(E);function L(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var w=function(){function e(t,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.value=t,this.color=r}var t,r,n;return t=e,(r=[{key:"render",value:function(){var e=this.value,t=this.color,r=e/100*360,n={borderColor:t,transform:"rotate( "+Math.min(r,360).toFixed(2)+"deg )"},a={};e>50&&(a={borderColor:t});var o=O()({"ppfr-circle":!0,"ppfr-circle--50":e>50});return React.createElement("div",{className:o},React.createElement("span",{className:"ppfr-circle__label"},e,"%"),React.createElement("div",{className:"ppfr-circle__slice"},React.createElement("div",{className:"ppfr-circle__slice__bar",style:n}),React.createElement("div",{className:"ppfr-circle__slice__fill",style:a})))}}])&&L(t.prototype,r),n&&L(t,n),e}();function x(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var j=function(){function e(t,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.value=t,this.color=r}var t,r,n;return t=e,(r=[{key:"render",value:function(){var e=this.value,t={background:this.color,width:Math.min(e,100)+"%"};return React.createElement("div",{className:"ppfr-progress"},React.createElement("div",{className:"ppfr-progress__bar",style:t},React.createElement("span",{className:"ppfr-progress__bar__status"},e,"%")))}}])&&x(t.prototype,r),n&&x(t,n),e}();function A(e){return(A="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function P(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function N(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function k(e,t){return(k=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function S(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=D(e);if(t){var a=D(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return T(this,r)}}function T(e,t){return!t||"object"!==A(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function D(e){return(D=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var V=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&k(e,t)}(o,e);var t,r,n,a=S(o);function o(){return P(this,o),a.apply(this,arguments)}return t=o,(r=[{key:"render",value:function(){var e,t=this.props,r=t.color,n=t.style,a=t.value;switch(n){case"circle":e=new w(a,r);break;case"bar":default:e=new j(a,r)}return e.render()}}])&&N(t.prototype,r),n&&N(t,n),o}(b.Component),M=function(e){var t=e.attributes,r=e.setAttributes,n=(e.className,t.targetLabel),a=t.targetAmount,o=t.raisedLabel,c=t.raisedAmount,u=t.contributionsLabel,m=t.contributionsValue,b=t.color,d=t.currencyCode,g=t.currencyDecimals,y=t.locale;o||r({raisedLabel:Object(l.__)("Raised","pronamic-pay-fundraising")}),n||r({targetLabel:Object(l.__)("Target","pronamic-pay-fundraising")}),u||r({contributionsLabel:Object(l.__)("Contributions","pronamic-pay-fundraising")}),c=c||"",a=a||"",m=m||"";var v=React.createElement(s.InspectorControls,null,React.createElement(i.PanelBody,null,React.createElement(i.TextControl,{label:Object(l.__)("Target","pronamic-pay-fundraising"),value:a,onChange:function(e){r({targetAmount:e.replace(/,/g,".")})}}),React.createElement(i.TextControl,{label:Object(l.__)("Raised","pronamic-pay-fundraising"),value:c,onChange:function(e){r({raisedAmount:e.replace(/,/g,".")})}}),React.createElement(i.TextControl,{label:Object(l.__)("Contributions","pronamic-pay-fundraising"),value:m,onChange:function(e){r({contributionsValue:e.replace(/[^\d]/g,"")})}}),React.createElement(s.ColorPalette,{colors:p,value:b,onChange:function(e){r({color:e})}})));return React.createElement("div",{className:"ppfr-block ppfr-block-circle"},v,React.createElement("div",{className:"ppfr-block-circle__container"},React.createElement("div",{className:"ppfr-block__container__col"},React.createElement(V,{style:"circle",color:b,value:f(c,a)})),React.createElement("div",{className:"ppfr-block__container__col"},React.createElement(C,{setAttributes:r,raisedLabel:o,raisedAmount:c,targetLabel:n,targetAmount:a,contributionsLabel:u,contributionsValue:m||"0",locale:y,currencyCode:d,currencyDecimals:g}))))},B=r(4);var F={from:[{type:"block",blocks:["pronamic-pay/fundraising-progress-bar","pronamic-pay/fundraising-progress-text"],transform:function(e){return Object(c.createBlock)("pronamic-pay/fundraising-progress-circle",e)}}]},Z=B.attributes,I=B.category,G=B.name,U={title:Object(l.__)("Fundraising Progress Circle","pronamic-pay-fundraising"),description:Object(l.__)("Displays fundraising information with circular progress chart.","pronamic-pay-fundraising"),category:I,icon:u,example:{},attributes:Z,edit:M,save:function(e){return e.attributes,null},transforms:F},J=React.createElement(i.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},React.createElement(i.Path,{d:"M19 7 C21.761 7 24 9.239 24 12 24 14.761 21.761 17 19 17 L5 17 C2.239 17 0 14.761 0 12 0 9.239 2.239 7 5 7 Z M19 9 L5 9 C3.343 9 2 10.343 2 12 2 13.598 3.249 14.904 4.824 14.995 L5 15 19 15 C20.657 15 22 13.657 22 12 22 10.402 20.751 9.096 19.176 9.005 Z M13 10 C14.105 10 15 10.895 15 12 15 13.105 14.105 14 13 14 L5 14 C3.895 14 3 13.105 3 12 3 10.895 3.895 10 5 10 Z"})),z=function(e){var t=e.attributes,r=e.setAttributes,n=e.className,a=t.targetLabel,o=t.targetAmount,c=t.raisedLabel,u=t.raisedAmount,m=t.color,b=t.currencyCode,d=t.currencyDecimals,g=t.locale;c||r({raisedLabel:Object(l.__)("Raised:","pronamic-pay-fundraising")}),a||r({targetLabel:Object(l.__)("Target:","pronamic-pay-fundraising")}),u=u||"",o=o||"";var y=React.createElement(s.InspectorControls,null,React.createElement(i.PanelBody,null,React.createElement(i.TextControl,{label:Object(l.__)("Target","pronamic-pay-fundraising"),value:o,onChange:function(e){r({targetAmount:e.replace(/,/g,".")})}}),React.createElement(i.TextControl,{label:Object(l.__)("Raised","pronamic-pay-fundraising"),value:u,onChange:function(e){r({raisedAmount:e.replace(/,/g,".")})}}),React.createElement(s.ColorPalette,{colors:p,value:m,onChange:function(e){r({color:e})}}))),v=n+" ppfr-block ppfr-block-bar",h={raisedLabel:m,raisedAmount:m};return React.createElement("div",{className:v},y,React.createElement(V,{color:m,value:f(u,o)}),React.createElement(C,{setAttributes:r,colors:h,raisedLabel:c,raisedAmount:u,targetLabel:a,targetAmount:o,locale:g,currencyCode:b,currencyDecimals:d}))},$=r(5);var H={from:[{type:"block",blocks:["pronamic-pay/fundraising-progress-circle","pronamic-pay/fundraising-progress-text"],transform:function(e){return Object(c.createBlock)("pronamic-pay/fundraising-progress-bar",e)}}]},q=$.attributes,K=$.category,Q=$.name,W={title:Object(l.__)("Fundraising Progress Bar","pronamic-pay-fundraising"),description:Object(l.__)("Displays fundraising raised and target amount with progress bar.","pronamic-pay-fundraising"),category:K,icon:J,example:{},attributes:q,edit:z,save:function(e){var t=e.attributes;return t.color,t.raisedLabel,t.raisedAmount,t.targetLabel,t.targetAmount,null},transforms:H},X=React.createElement(i.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},React.createElement(i.Path,{d:"M23,16 C23.5522847,16 24,16.4477153 24,17 C24,17.5522847 23.5522847,18 23,18 L1,18 C0.44771525,18 6.76353751e-17,17.5522847 0,17 C-6.76353751e-17,16.4477153 0.44771525,16 1,16 L23,16 Z M23,12 C23.5522847,12 24,12.4477153 24,13 C24,13.5522847 23.5522847,14 23,14 L1,14 C0.44771525,14 6.76353751e-17,13.5522847 0,13 C-6.76353751e-17,12.4477153 0.44771525,12 1,12 L23,12 Z M9,6 C10.1045695,6 11,6.8954305 11,8 C11,9.1045695 10.1045695,10 9,10 L2,10 C0.8954305,10 1.3527075e-16,9.1045695 0,8 C-1.3527075e-16,6.8954305 0.8954305,6 2,6 L9,6 Z"})),Y=function(e){var t=e.attributes,r=e.setAttributes,n=e.className,a=t.raisedLabel,o=t.raisedAmount,c=t.contributionsLabel,u=t.contributionsValue,f=t.color,m=t.currencyCode,b=t.currencyDecimals,d=t.locale;a||r({raisedLabel:Object(l.__)("Raised","pronamic-pay-fundraising")}),c||r({contributionsLabel:Object(l.__)("contributions","pronamic-pay-fundraising")}),o=o||"",u=u||"";var g=React.createElement(s.InspectorControls,null,React.createElement(i.PanelBody,null,React.createElement(i.TextControl,{label:Object(l.__)("Raised","pronamic-pay-fundraising"),value:o,onChange:function(e){r({raisedAmount:e.replace(/,/g,".")})}}),React.createElement(i.TextControl,{label:Object(l.__)("Contributions","pronamic-pay-fundraising"),value:u,onChange:function(e){r({contributionsValue:e.replace(/[^\d]/g,"")})}}),React.createElement(s.ColorPalette,{colors:p,value:f,onChange:function(e){r({color:e})}}))),y=n+" ppfr-block ppfr-block-compact",v={raisedAmount:f};return React.createElement("div",{className:y},g,React.createElement(C,{setAttributes:r,colors:v,raisedLabel:a,raisedAmount:o,contributionsLabel:c,contributionsValue:u,locale:d,currencyCode:m,currencyDecimals:b}))},ee=r(6);var te={from:[{type:"block",blocks:["pronamic-pay/fundraising-progress-circle","pronamic-pay/fundraising-progress-bar"],transform:function(e){return Object(c.createBlock)("pronamic-pay/fundraising-progress-text",e)}}]},re=ee.attributes,ne=ee.category,ae=ee.name,oe={title:Object(l.__)("Fundraising Progress","pronamic-pay-fundraising"),description:Object(l.__)("Displays fundraising raised amount and number of contributions.","pronamic-pay-fundraising"),category:ne,icon:X,example:{},attributes:re,edit:Y,save:function(e){var t=e.attributes;return t.color,t.raisedLabel,t.raisedAmount,t.contributionsLabel,t.contributionsValue,null},transforms:te};[n,a,o].forEach((function(e){if(e){var t=e.name,r=e.settings;Object(c.registerBlockType)(t,r)}})),Object(c.updateCategory)("pronamic-pay",{icon:React.createElement(i.SVG,{width:"24",height:"24",viewBox:"0 0 512 512",xmlns:"http://www.w3.org/2000/svg"},React.createElement(i.Path,{d:"M256 0c141.385 0 256 114.615 256 256S397.385 512 256 512c-48.85 0-94.504-13.682-133.34-37.424L174.558 384h92.988c70.693 0 128-57.308 128-128 0-70.692-57.307-128-128-128h-46.682c-15.248 0-27.608 12.36-27.608 27.608 0 15.247 12.36 27.608 27.608 27.608h46.682c40.198 0 72.784 32.586 72.784 72.784 0 40.198-32.586 72.784-72.784 72.784H167.153c-12.869 0-23.681 8.805-26.741 20.72a28 28 0 00-.606 1.966l-30.622 114.273C43.161 419.443 0 342.762 0 256 0 114.615 114.615 0 256 0zm11.545 220.863h-65.757c-19.406 0-35.137 15.731-35.137 35.137s15.731 35.137 35.137 35.137h65.757c19.406 0 35.137-15.731 35.137-35.137s-15.731-35.137-35.137-35.137z",fill:"#A0A5AA"}))})}]);
0 ignored issues
show
Coding Style Best Practice introduced by
Curly braces around statements make for more readable code and help prevent bugs when you add further statements.

Consider adding curly braces around all statements when they are executed conditionally. This is optional if there is only one statement, but leaving them out can lead to unexpected behaviour if another statement is added later.

Consider:

if (a > 0)
    b = 42;

If you or someone else later decides to put another statement in, only the first statement will be executed.

if (a > 0)
    console.log("a > 0");
    b = 42;

In this case the statement b = 42 will always be executed, while the logging statement will be executed conditionally.

if (a > 0) {
    console.log("a > 0");
    b = 42;
}

ensures that the proper code will be executed conditionally no matter how many statements are added or removed.

Loading history...
Bug introduced by
The variable n seems to be never initialized.
Loading history...
Coding Style introduced by
Consider using undefined instead of void(0). It is equivalent and more straightforward to read.
Loading history...
Comprehensibility introduced by
Usage of the sequence operator is discouraged, since it may lead to obfuscated code.

The sequence or comma operator allows the inclusion of multiple expressions where only is permitted. The result of the sequence is the value of the last expression.

This operator is most often used in for statements.

Used in another places it can make code hard to read, especially when people do not realize it even exists as a seperate operator.

This check looks for usage of the sequence operator in locations where it is not necessary and could be replaced by a series of expressions or statements.

var a,b,c;

a = 1, b = 1,  c= 3;

could just as well be written as:

var a,b,c;

a = 1;
b = 1;
c = 3;

To learn more about the sequence operator, please refer to the MDN.

Loading history...
Bug introduced by
The variable Symbol seems to be never declared. If this is a global, consider adding a /** global: Symbol */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
Comprehensibility introduced by
It seems like you are trying to overwrite a function name here. R is already defined in line 6 as a function. While this will work, it can be very confusing.
Loading history...
Comprehensibility introduced by
It seems like you are trying to overwrite a function name here. d is already defined in line 6 as a function. While this will work, it can be very confusing.
Loading history...
Comprehensibility introduced by
It seems like you are trying to overwrite a function name here. v is already defined in line 6 as a function. While this will work, it can be very confusing.
Loading history...
Coding Style Best Practice introduced by
By convention, constructors like j should be capitalized.
Loading history...
Best Practice introduced by
Comparing 0 to t = parseFloat(t || 0) using the == operator is not safe. Consider using === instead.
Loading history...
Coding Style Best Practice introduced by
By convention, constructors like w should be capitalized.
Loading history...
Comprehensibility introduced by
It seems like you are trying to overwrite a function name here. A is already defined in line 6 as a function. While this will work, it can be very confusing.
Loading history...
Complexity introduced by
A for in loop automatically includes the property of any prototype object, consider checking the key using hasOwnProperty.

When iterating over the keys of an object, this includes not only the keys of the object, but also keys contained in the prototype of that object. It is generally a best practice to check for these keys specifically:

var someObject;
for (var key in someObject) {
    if ( ! someObject.hasOwnProperty(key)) {
        continue; // Skip keys from the prototype.
    }

    doSomethingWith(key);
}
Loading history...
Comprehensibility introduced by
It seems like you are trying to overwrite a function name here. k is already defined in line 6 as a function. While this will work, it can be very confusing.
Loading history...
Best Practice introduced by
Comparing 0 to 100 * e = parseFloat(e) % 100 using the == operator is not safe. Consider using === instead.
Loading history...
Best Practice introduced by
Comparing 0 to e using the == operator is not safe. Consider using === instead.
Loading history...
Bug introduced by
The variable React seems to be never declared. If this is a global, consider adding a /** global: React */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
Comprehensibility introduced by
It seems like you are trying to overwrite a function name here. D is already defined in line 6 as a function. While this will work, it can be very confusing.
Loading history...
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...